<% provide(:head_title, t("libraries.show.head_title", library: @repository.name)) %>
<%= stylesheet_link_tag 'datatables' %>
<% provide(:container_class, "no-second-nav-container") %>
<% provide(:sidebar_url, sidebar_repositories_path) %>
<% provide(:sidebar_title, t('sidebar.repositories.sidebar_title')) %>

<% content_for :head do %>
  <meta id="cache-directive" name="turbolinks-cache-control" content="no-cache">
<% end %>

<div class="content-pane repository-show <%=  @repository.archived? || params[:archived] ? "archived" : "active" %>" data-table-url="<%= load_table_repository_path(@repository) %>" data-e2e="e2e-CO-invInventory-<%= @repository.id %>">
  <div id="repository-toolbar" class="content-header">
    <div class="title-row">
      <% if @repository.active? %>
        <div class="repository-title-name" data-view-mode="active">
          <h1 class="name-container">
            <% if @inline_editable_title_config.present? %>
              <%= render partial: "shared/inline_editing",
                         locals: {
                            initial_value: @repository.name,
                            config: @inline_editable_title_config
                         } %>
            <% else %>
              <div class="read-only-name">
                <%= @repository.name %>
              </div>
              <span class="repository-share-icon">
                <%= inventory_shared_status_icon(@repository, current_team) %>
              </span>
            <% end %>
          </h1>
          <% if @repository.shared_with_anybody? %>
            <% team_name = @repository.team == current_team ? t('repositories.show.your_team') : @repository.team.name %>
            <div class="repository-subtitle mt-0.5"><%= t('repositories.show.subtitle', team_name: team_name) %></div>
          <% end %>
        </div>
      <% end %>
      <div class="repository-archived-title-name" data-view-mode="archived">
        <% if @repository.archived? %>
          <span><%= t('labels.archived')%></span>&nbsp;
          <%= t('repositories.show.archived_inventory', repository_name: @repository.name) %>
        <% else %>
          <%= t('repositories.show.archived_inventory_items', repository_name: @repository.name) %>
        <% end %>
      </div>
    </div>
  </div>

  <!-- These buttons are appended to table in javascript, after table initialization -->
  <div class="toolbar-filter-buttons" style="display:none">
  </div>

  <!-- Inventory Item landing page link-->
  <% if @repository_row && @repository_row_landing_page %>
    <a id="itemLandingPagelink" href="<%= repository_repository_row_path(@repository, @repository_row) %>" class="hidden record-info-link"></a>
  <% elsif @repository_row_landing_page %>
    <div id="repositoryItemErrorSidebar" data-behaviour="vue" class="fixed top-0 right-0 h-full z-[2039]">
      <repository-item-error-sidebar />
    </div>
  <% end %>



  <%= render partial: "repositories/repository_table",
             locals: {
               repository: @repository,
               repository_index_link: repository_table_index_path(@repository)
             }
  %>

  <div id="actionToolbar" data-behaviour="vue">
    <action-toolbar actions-url="<%= actions_toolbar_repository_repository_rows_path(@repository) %>" />
  </div>
</div>

<%= render partial: 'repositories/import_repository_records_modal',
                    locals: { repository: @repository } %>


<%= render partial: "repositories/delete_record_modal" %>
<%= render partial: "repositories/delete_asset_value_modal" %>
<%= render partial: 'repositories/export_repository_rows_modal',
           locals: { repository: @repository } %>

<%= render partial: 'repository_columns/manage_column_modal', locals: { my_module_page: false } %>
<%= render partial: "toolbar_buttons", locals: { view_mode: @repository.archived? || params[:archived] ? 'archived' : 'active' } %>
<%= render partial: "assign_items_to_task_modal" %>

<%= render partial: 'repository_filters' %>
<%= render partial: 'save_repository_filter_modal' %>

<div id="importRepositoryModal" data-behaviour="vue">
  <import-repository-modal repository-url="<%= repository_path(@repository) %>" />
</div>

<%= javascript_include_tag 'vue_components_action_toolbar' %>
<%= javascript_include_tag 'vue_repository_search' %>
<%= javascript_include_tag 'vue_import_repository_modal' %>
<%= javascript_include_tag 'repositories/repository_datatable' %>
<%= javascript_include_tag "repositories/show" %>
<%= javascript_include_tag "vue_components_repository_item_error_sidebar" %>
<%= javascript_include_tag 'inputmask' %>
<%= javascript_include_tag 'emoji_button' %>
<%= javascript_include_tag 'pdf_js' %>
<%= stylesheet_link_tag 'pdf_js_styles' %>
